import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../views/Login.vue";
Vue.use(VueRouter);

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}


const routes = [
  {
    path: "/",
    name: "Index",
    component: () =>
      import("../views/Index.vue")
  },
  {
    path: "/login",
    name: "Login",
    component: Login
  },
  {
    path:"/register",
    name:"Register",
    component: () => import("../views/register")
  },
  {
    path: "/index",
    name: "Index",
    component: () =>
      import("../views/Index.vue")
  },
  {
    path: "/aside",
    name: "Aside",
    component: () =>
      import("../views/aside.vue")
  },
  {
    path:"/agency/:aid",
    name:'Agency',
    component: () =>
      import("../views/agencyItem.vue")
  },
  {
    path:"/pet/:id",
    name:'pet',
    component: () =>
      import("../views/petItem.vue")
  },
  {
    path:"/agency_list",
    name:'agency_list',
    component: () => 
      import("../views/agency.vue")
  },
  {
    path:"/kind/:name/:index",
    name:"kind",
    component: () =>
      import ("../views/kind.vue")
  },
  {
    path:"/search",
    name:"search",
    component: () =>
      import ("../views/search.vue")
  },
  {
    path:'/search_petlist',
    name:'searchPetList',
    component: () =>
      import ("../views/searchPetList.vue")
  },
  {
    path:'/filter',
    name:'filter',
    component: () =>
      import ("../views/filter.vue")
  },
  {
    path:'/favor',
    name:'favor',
    component: () =>
      import ("../views/favorite.vue")
  },
  {
    path:'/profile',
    name:'profile',
    component: () =>
      import('../views/profile.vue')
  },
  {
    path:'/apporint/:id/:aid',
    name:'apporint',
    component: () =>
    import('../views/apporintment.vue')
  },
  {
    path:'/upload_img',
    name:'uploadImg',
    component: () =>
    import('../components/headProfile.vue')
  },
  {
    path:'/order-list',
    name:'orderList',
    component: () => 
    import('../views/order.vue')
  },
  {
    path:'/modify-info',
    name:'modifyInfo',
    component: () =>
    import('../views/meInfo.vue')
  }
];

const router = new VueRouter({
  routes
});

export default router;
